<?php
function sql() {
	if (!class_exists('ConnectionManager') || Configure::read('debug') < 2) {
		return false;
	}
	
	$sources = ConnectionManager::sourceList();

	$logs = array();
	foreach ($sources as $source):
		$db = ConnectionManager::getDataSource($source);
		if (!method_exists($db, 'getLog')):
			continue;
		endif;
		$logs[$source] = $db->getLog(false, false);
	endforeach;
	
	return $logs;
}